import React, { memo, useEffect } from 'react'
import { shallowEqual, useDispatch, useSelector } from 'react-redux'
import { getHomeData } from '@/store/modules/home'

import HomeBanner from './c-cpn/home-banner/home-banner'
import HomeSelectV1 from './c-cpn/home-select-v1/home-select-v1'
import { SelectWrapper } from './style'

const Home = memo(() => {

  const{ goodPriceInfo } = useSelector(state => ({
    goodPriceInfo: state.Home.heigthPriceRoom,
  }), shallowEqual)

  console.log(goodPriceInfo)

  const dispatch = useDispatch()
  useEffect(() => {
    dispatch(getHomeData())
  }, [dispatch])


  return (
    <div>
      {/* 轮播 */}
      <HomeBanner></HomeBanner>
      {/* 列表 */}
      <SelectWrapper>
        <HomeSelectV1 goodsPriceInfo={goodPriceInfo} roomwidth="25%"/>
      </SelectWrapper>
    </div>
  )
})

export default Home
